<template>
  <div>
    <breadcrumb
      lastBreadTitle="项目详情"
      :breadPathList="breadPathList"
      :showBackBtnFlag="true"
      @handleBack="handleBack"
      :showBackBtnFlagList="['/FilingHandover/detail']"
    />
    <div ref="demo" style="display: none" />

    <div class="app-main">
      <el-form :inline="true" style="display:flex; flex-wrap: wrap; padding-right:10px">
        <el-form-item style="flex: 1; min-width: 140px">
          <el-button type="primary" @click="download" max-width="60">导出{{ isDownloading ? "中..." : "" }}</el-button>
          <el-button type="primary" @click="print" flex="1">打印</el-button>
        </el-form-item>
      </el-form>

      <div ref="content" style="width: 100%;">
        <div class="print_title">项目归档资料移交清单</div>
        <div class="print_context">
          <div>
            <div>项目名称：{{ filingHandover.projectName }}</div>
          </div>
          <div>
            <div>项目编号：{{filingHandover.projectCode}}</div>
            <div>档案编号：</div>
            <div>开标时间：{{formatDateFn(filingHandover.openStartTime, "yyyy-MM-dd HH:mm") }}</div>
          </div>
          <div>
            <div>项目所属部门：{{filingHandover.businessUnit}}</div>
            <div>项目经办人：{{filingHandover.operateUserName}}</div>
            <div>评标时间：{{formatDateFn(filingHandover.evaluationStartTime, "yyyy-MM-dd HH:mm") }}</div>
          </div>
        </div>
        <el-table
          no-hover
          border
          align="center"
          :data="tableList"
          :span-method="arraySpanMethod"
          :header-cell-style="handerMethod"
          header-row-class-name="out-Table-header">
          <el-table-column type="index" label="序号" width="50" align="center" />
          <el-table-column prop="tache" label="交易环节" align="center" />
          <el-table-column prop="datum" label="资料名称" align="center" />
          <el-table-column label="份数" align="center" width="160">
            <template slot-scope="scope">

              <el-input
                v-model="scope.row.copies"
                size="mini"
                v-if="scope.row.tache === ''"
              />
              <el-input-number
                v-else-if="scope.row.tache !== '合计'"
                size="mini"
                v-model="scope.row.copies"
                :step="1"
                :precision="1"
                :min="0"
                :max="9999"></el-input-number>
              <span v-else>{{copiesSum}}</span>
            </template>
          </el-table-column>
          <el-table-column label="页数" align="center" width="160">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.pagination"
                size="mini"
                v-if="scope.row.tache === ''"
              />
              <el-input-number
                v-else-if="scope.row.tache !== '合计'"
                size="mini"
                v-model="scope.row.pagination"
                :step="1"
                :precision="1"
                :min="0"
                :max="9999"></el-input-number>
              <span v-else>{{paginationSum}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="remark" label="备注" width="100" align="center">
            <template slot-scope="scope"   v-if="scope.row.tache !== '合计'">
              <el-radio v-model="scope.row.remark" label="原件">原件</el-radio>
            </template>
          </el-table-column>
          <el-table-column prop="remark" label="备注" width="100" align="center">
            <template slot-scope="scope"   v-if="scope.row.tache !== '合计'">
              <el-radio v-model="scope.row.remark" label="复印件">复印件</el-radio>
            </template>
          </el-table-column>
          <el-table-column prop="remark" label="备注" width="100" align="center">
            <template slot-scope="scope"   v-if="scope.row.tache !== '合计'">
              <el-radio v-model="scope.row.remark" label="电子版">电子版</el-radio>
            </template>
          </el-table-column>
        </el-table>

        <div class="print_context print_context-botton">
          <div>
            <div>交易方式：
              <label>
                <input type="radio" v-model="filingHandover.tenderMode" value="PUBLIC_BIDDING" disabled />
                公开招标
              </label>

              <label>
                <input type="radio" v-model="filingHandover.tenderMode" value="INVITE_BIDDING" disabled/>
                邀请招标
              </label>
            </div>
          </div>
          <div>
            <div>移交人：</div>
            <div>接收人：</div>
          </div>
          <div>
            <div class="date">移交日期：<span>{{getY()}}</span>年<span> {{getM()}}</span>月 <span>{{getD()}}</span>日</div>
            <div class="date">接受日期：<span/>年<span/> 月 <span/>日</div>
          </div>
        </div>
      </div>
    </div>

    <div style="position: fixed; right: 10000px">
      <div ref="paintTable">
        <div class="print_title">项目归档资料移交清单</div>
        <div class="print_context">
          <div>
            <div>项目名称：{{ filingHandover.projectName }}</div>
          </div>
          <div>
            <div>项目编号：{{filingHandover.projectCode}}</div>
            <div>档案编号：</div>
            <div>开标时间：{{formatDateFn(filingHandover.openStartTime, "yyyy-MM-dd HH:mm") }}</div>
          </div>
          <div>
            <div>项目所属部门：{{filingHandover.businessUnit}}</div>
            <div>项目经办人：{{filingHandover.operateUserName}}</div>
            <div>评标时间：{{formatDateFn(filingHandover.evaluationStartTime, "yyyy-MM-dd HH:mm") }}</div>
          </div>
        </div>
        <div class="paint-table" v-if="tableList.length > 0">
          <div class="paint-table-title">
            <div>序号</div>
            <div>交易环节</div>
            <div>资料名称</div>
            <div>份数</div>
            <div>页数</div>
            <div>备注</div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              1
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[0].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[0].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[0].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[0].remark" value="原件" name="tableList_0" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[0].remark" value="复印件" name="tableList_0" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[0].remark" value="电子版" name="tableList_0" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              2
            </div>
            <div class="paint-table-td" style="border-bottom: none">
              开标阶段
            </div>
            <div class="paint-table-td">
              {{ tableList[1].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[1].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[1].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[1].remark" value="原件" name="tableList_1" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[1].remark" value="复印件" name="tableList_1" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[1].remark" value="电子版" name="tableList_1" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              3
            </div>
            <div class="paint-table-td">
            </div>
            <div class="paint-table-td">
              {{ tableList[2].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[2].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[2].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[2].remark" value="原件" name="tableList_2" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[2].remark" value="复印件" name="tableList_2" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[2].remark" value="电子版" name="tableList_2" />
              </label>
            </div>
          </div>

          <div class="paint-table-tr">
            <div class="paint-table-td">
              4
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[3].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[3].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[3].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[3].remark" value="原件" name="tableList_3" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[3].remark" value="复印件" name="tableList_3" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[3].remark" value="电子版" name="tableList_3" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              5
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[4].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[4].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[4].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[4].remark" value="原件" name="tableList_4" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[4].remark" value="复印件" name="tableList_4" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[4].remark" value="电子版" name="tableList_4" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              6
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[5].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[5].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[5].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[5].remark" value="原件" name="tableList_5" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[5].remark" value="复印件" name="tableList_5" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[5].remark" value="电子版" name="tableList_5" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              7
            </div>
            <div class="paint-table-td" style="border-bottom: none">
              审批阶段
            </div>
            <div class="paint-table-td">
              {{ tableList[6].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[6].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[6].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[6].remark" value="原件" name="tableList_6" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[6].remark" value="复印件" name="tableList_6" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[6].remark" value="电子版" name="tableList_6" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              8
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[7].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[7].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[7].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[7].remark" value="原件" name="tableList_7" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[7].remark" value="复印件" name="tableList_7" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[7].remark" value="电子版" name="tableList_7" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              9
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[8].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[8].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[8].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[8].remark" value="原件" name="tableList_8" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[8].remark" value="复印件" name="tableList_8" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[8].remark" value="电子版" name="tableList_8" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              10
            </div>
            <div class="paint-table-td" style="border-bottom: none">
            </div>
            <div class="paint-table-td">
              {{ tableList[9].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[9].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[9].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[9].remark" value="原件" name="tableList_9" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[9].remark" value="复印件" name="tableList_9" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[9].remark" value="电子版" name="tableList_9" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              11
            </div>
            <div class="paint-table-td">
            </div>
            <div class="paint-table-td">
              {{ tableList[10].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[10].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[10].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[10].remark" value="原件" name="tableList_10" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[10].remark" value="复印件" name="tableList_10" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[10].remark" value="电子版" name="tableList_10" />
              </label>
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              12
            </div>
            <div class="paint-table-td" style="width: 38%">
              合计
            </div>
            <div class="paint-table-td" style="display: none">
            </div>
            <div class="paint-table-td">
              {{ copiesSum }}
            </div>
            <div class="paint-table-td">
              {{ paginationSum }}
            </div>
            <div class="paint-table-td">
            </div>
            <div class="paint-table-td">
            </div>
            <div class="paint-table-td">
            </div>
          </div>
          <div class="paint-table-tr">
            <div class="paint-table-td">
              13
            </div>
            <div class="paint-table-td">
            </div>
            <div class="paint-table-td">
              {{ tableList[12].datum }}
            </div>
            <div class="paint-table-td">
              {{ tableList[12].copies }}
            </div>
            <div class="paint-table-td">
              {{ tableList[12].pagination }}
            </div>
            <div class="paint-table-td">
              <label>
                原件
                <input type="radio" v-model=" tableList[12].remark" value="原件" name="tableList_12" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                复印件
                <input type="radio" v-model=" tableList[12].remark" value="复印件" name="tableList_12" />
              </label>
            </div>
            <div class="paint-table-td">
              <label>
                电子版
                <input type="radio" v-model=" tableList[12].remark" value="电子版" name="tableList_12" />
              </label>
            </div>
          </div>
        </div>
        <div class="print_context print_context-botton">
          <div>
            <div>交易方式：
              <label>
                <input type="radio" v-model="filingHandover.tenderMode" value="PUBLIC_BIDDING" />
                公开招标
              </label>

              <label>
                <input type="radio" v-model="filingHandover.tenderMode" value="INVITE_BIDDING" />
                邀请招标
              </label>
            </div>
          </div>
          <div>
            <div>移交人：</div>
            <div>接收人：</div>
          </div>
          <div>
            <div class="date">移交日期：<span>{{ getY() }}</span>年<span> {{ getM() }}</span>月 <span>{{ getD() }}</span>日
            </div>
            <div class="date">接受日期：<span />年<span /> 月 <span />日</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>


import { mapGetters, mapMutations } from "vuex";
import css from "./css.js";
import { witnessRecordDistributeList } from "@/api/api";
import { blobByUtf8, formatDateFn } from "@/utils/utils";
import { GZAPI_EvaluationTime } from "../../../../gz_plugin/api";
import moment from "moment";
import axios from "axios";

const remarkMap = ["原件", "复印件", "电子版"];
const tableListMap = [
  {
    tache: "开标阶段",
    datum: "代理机构委托书和承诺书"
  },
  {
    tache: "开标阶段",
    datum: "开标会议签到表"
  },
  {
    tache: "开标阶段",
    datum: "开标情况记录表"
  },
  {
    datum: "专家签到表(含业主专家授权委托书)",
    tache: "评审阶段"
  },
  {
    datum: "专家承诺书或评委守则",
    tache: "评审阶段"
  },
  {
    datum: "投标文件审查表(含形式审查表、资格审查表、响应性审查表、符合性审查表等)",
    tache: "评审阶段"
  },
  {
    datum: "专家评分表",
    tache: "评审阶段"
  },
  {
    datum: "评分汇总表",
    tache: "评审阶段"
  },
  {
    datum: "评审报告",
    tache: "评审阶段"
  },
  {
    datum: "见证记录表",
    tache: "评审阶段"
  },
  {
    datum: "其他",
    tache: "评审阶段"
  },
  {
    datum: "合计",
    tache: "合计"
  },
  {
    datum: "第一中标候选人投标文件副本或电子文件",
    tache: ""
  }
];
const date = new Date();

export default {
  data: () => ({
    isDownloading: false,
    breadPathList: [{
      path: "/FilingHandover/list",
      title: "项目归档资料移交清单表"
    }],
    tableList: [],
    filingHandover: {}
  }),

  created() {
    this.getFilingHandover();
  },

  methods: {
    formatDateFn,
    handleBack() {
      this.$router.push({ path: "/FilingHandover/list" });
    },

    arraySpanMethod({ rowIndex, columnIndex, row }) {
      if (columnIndex === -1) {
      }

      if (columnIndex === 1) {
        switch (rowIndex) {
          case 0:
            return [3, 1];
          case 3:
            return [8, 1];
          case 11:
            return [1, 2];
          case 12:
            return [1, 1];
          default:
            return [0, 0];
        }
      } else if (columnIndex === 2 && rowIndex === 11) {
        return [0, 0];
      }
    },

    handerMethod({ row, column, rowIndex, columnIndex }) {
      row[5].colSpan = 5;
      row[6].colSpan = 0;
      row[7].colSpan = 0;
      if (columnIndex > 5) {
        return {
          display: "none"
        };
      }
    },

    // 分解值
    decompositionDatumValue(datumValue, tache) {
      const isOptString = tache === '';
      let copies = isOptString ? '' : 0;
      let pagination = isOptString ? '' : 0;
      let remark = "复印件";
      if (datumValue) {
        const [v1, v2, v3] = datumValue.split(",");
        if(!isOptString){
          if (!isNaN(v1)) {
            copies = Number(v1);
          }
          if (!isNaN(v2)) {
            pagination = Number(v2);
          }
        } else {

          copies = v1;
          pagination = v2;
        }
        if (v3 && remarkMap.includes(v3)) {
          remark = v3;
        }
      }
      return {
        copies,
        pagination,
        remark
      };
    },

    initTableList() {
      let copiesTotal = 0, paginationTotal = 0;

      this.tableList = tableListMap.map((item, index) => {
        let { copies, pagination, remark } = this.decompositionDatumValue(this.extendData[item.datum], item.tache);
        return {
          remark,
          copies,
          pagination,
          ...item
        };
      });
      console.log("this.tableList", this.tableList);
    },

    async download() {
      try {
        if (this.isDownloading) {
          return;
        }
        this.isDownloading = true;
        const {
          filingHandover: {
            projectId,
            openStartTime: openTime,
            evaluationStartTime: evaTime
          },
          copiesSum: copySum,
          paginationSum: pageSum
        } = this;
        const params = {
          projectId,//项目id
          openTime,//开标时间
          evaTime,//评标时间
          copySum, //份数合计
          pageSum,//页数合计
          extendData: this.jsonExtendData(this.tableList)
          // extendData: JSON.stringify(this.tableList.map(({ datum,copies, pagination, remark}) => {
          //   return {
          //     datum, // 资料名称
          //     copies, // 份数
          //     pagination, // 页数
          //     remark // 备注
          //   }
          // }))
        };

        const instance = axios.create({
          contentType: "application/json;charset=UTF-8",
          responseType: "blob"
        });

        const res = await instance.post("/gdw/gz/witness/export/filingHandoverExcel", params);
        const fileName = "项目归档资料移交清单表.xlsx";
        const csvData = new Blob([res.data], { type: "application/xlsx" });
        // try{
        //   const data = await blobByUtf8(csvData);
        //   if(data && data.message){
        //     this.$message.warning(data.message)
        //     return;
        //   }
        // } catch (e) {
        //
        // }

        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
          window.navigator.msSaveOrOpenBlob(csvData, fileName);
        } else {
          const a = document.createElement("a");
          document.body.appendChild(a);
          a.style = "display: none";
          const url = window.URL.createObjectURL(csvData);
          a.href = url;
          a.download = fileName;
          a.click();
          a.remove();
          window.URL.revokeObjectURL(url);
        }

        let id = setTimeout(() => {
          clearTimeout(id);
          this.$message.success("导出成功");
        }, 100);

        this.updateExtendData();
      } catch (e) {
        console.error(e);
      } finally {
        this.isDownloading = false;
      }
    },

    print() {
      let iframe = document.getElementById("iframeId");
      if (iframe) {
        this.$refs.demo.removeChild(iframe);
      }
      iframe = document.createElement("iframe");
      iframe.id = "iframeId";
      const style = document.createElement("style");
      style.innerHTML = css;
      iframe.onload = () => {
        const iframeBody = iframe.contentDocument || iframe.contentWindow.document;
        iframeBody.body.appendChild(style);
        iframeBody.body.appendChild(this.$refs.paintTable);
        iframe.contentWindow.print();
      }

      this.$refs.demo.appendChild(iframe);
      this.updateExtendData();
    },

    // 获取项目详情
    async getFilingHandover() {
      const { code, data, message } = await witnessRecordDistributeList({
        type: 2,
        search: this.projectCode,
        currentPage: 1,
        pageSize: 10
      });
      if (code === 0) {
        if (data && data.data && data.data.length > 0) {
          this.filingHandover = data.data[0];
          const { evaluationStartTime, openStartTime } = this.filingHandover.bidSectionVOList[0];
          this.filingHandover.evaluationStartTime = evaluationStartTime;
          this.filingHandover.openStartTime = openStartTime;

          console.log("filingHandover1", this.filingHandover);
        }
      } else {
        this.$message.warning(message);
      }
      this.initTableList();
    },

    // 更新项目归档资料数据
    updateExtendData() {
      const { projectId } = this.filingHandover;
      GZAPI_EvaluationTime.updateExtendData({
        projectId,
        extendData: this.jsonExtendData(this.tableList)
      });
    },


    jsonExtendData(tableList) {
      const extendData = {};
      tableList.forEach((({ tache, copies, pagination, remark, datum }) => {
        if (tache !== "合计") {
          extendData[datum] = `${copies},${pagination},${remark}`;
        }
      }));
      return JSON.stringify(extendData);
    },

    getY() {
      return this.$moment(date).format("yyyy");
    },
    getM() {
      return this.$moment(date).format("MM");
    },
    getD() {
      return this.$moment(date).format("DD");
    }
  },

  computed: {

    //份数合计
    copiesSum() {
      return this.tableList.reduce((number, { copies, tache }) => {
        return (!tache || tache === "合计") ? number : (number + copies);
      }, 0);
    },

    //页数合计
    paginationSum() {
      return this.tableList.reduce((number, { pagination, tache }) => {
        return (!tache || tache === "合计") ? number : (number + pagination);
      }, 0);
    },

    projectCode() {
      return this.$route.query.projectCode;
    },

    extendData() {
      const ed = this.filingHandover.extendData.replaceAll("&quot", "\"");
      try {
        return ed ? JSON.parse(ed) : {};
      } catch (e) {
        console.error(e);
        return {};
      }
    }
  }
};
</script>

<style lang="scss" scoped>
@import "./index.css";

.el-table {
  overflow: inherit;
}

.app-main {
  overflow: auto;
}
</style>
